package cn.edu.sdjzu.xg23.kcsj01_backend.controller;

import cn.edu.sdjzu.xg23.kcsj01_backend.controller.*;
import cn.edu.sdjzu.xg23.kcsj01_backend.entity.LiteratureDatabase;
import cn.edu.sdjzu.xg23.kcsj01_backend.service.*;
import cn.edu.sdjzu.xg23.kcsj01_backend.utils.*;
import cn.edu.sdjzu.xg23.kcsj01_backend.entity.*;
import cn.edu.sdjzu.xg23.kcsj01_backend.mapper.*;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
public class JournalImpactController {
    @Autowired
    private JournalImpactService journalImpactService;

    @GetMapping("/journalImpact")
    public Result get(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize,
            @RequestBody(required = false) JournalImpact journalImpact) {

        PageInfo<JournalImpact> journalImpactPageInfo = journalImpactService.get(pageNum, pageSize, journalImpact);
        System.out.println(journalImpactPageInfo);
        return Result.success(journalImpactPageInfo);
    }

    @PostMapping("journalImpact")
    public Result save(@RequestBody JournalImpact journalImpact) {
        return Result.success(journalImpactService.save(journalImpact));
    }

    @PutMapping("journalImpact")
    public Result update(@RequestBody JournalImpact journalImpact) {
        return Result.success(journalImpactService.update(journalImpact));
    }

    @DeleteMapping("journalImpact/{id}")
    public Result delete(@PathVariable long id) {
        return Result.success(journalImpactService.delete(id));
    }
}
